package cn.skyquant.quant4j.service.boot.model.order;

import cn.skyquant.quant4j.service.boot.model.account.Account;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.List;

@Repository
public interface AccountOrderHisRepository extends CrudRepository<AccountOrderHis, String> {

    List<AccountOrderHis> findByAccount(Account account);

    @Query(value="SELECT max(closeTime) FROM AccountOrderHis u WHERE u.account=?1 and u.symbol=?2")
    Date findMaxCloseTimeByAccountAndSymbol(Account account, String symbol);

}
